<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProjectsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('projects', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->comment('名称');
            $table->string('code')->unique()->comment('编号');
            $table->text('description')->nullable()->comment('描述');
            $table->unsignedTinyInteger('state')->default(1)->comment('是否有效，0:无效,1:有效');
            $table->unsignedInteger('customer')->nullable()->comment('所属客户');
            $table->unsignedInteger('department')->nullable()->comment('所属科室');
            $table->unsignedInteger('doctor')->nullable()->comment('所属医生');
            $table->string('organization')->nullable()->comment('合作机构(数据字典中的出报告单位)');
            $table->string('type')->nullable()->comment('项目类型');
            $table->unsignedInteger('leader')->nullable()->comment('负责人');
            $table->unsignedInteger('salesman')->nullable()->comment('项目销售');
            $table->unsignedInteger('money')->nullable()->comment('项目金额');
            $table->unsignedInteger('created_by')->comment('创建者');
            $table->unsignedInteger('updated_by')->comment('更新者');
            $table->string('data_scope')->nullable()->comment('数据域');
            $table->timestamps();

            $table->comment = '项目表';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('projects');
    }

}
